﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebApplicationSample.Customer;

namespace WebApplicationSample.Controllers
{
    public class HomeController : Controller
    {
        private readonly ICustomerProvider _customerProvider;

        public HomeController(ICustomerProvider customerProvider)
        {
            _customerProvider = customerProvider;
        }

        public ActionResult Index()
        {
            ViewBag.Title = "Home Page";

            return View();
        }

        public ActionResult Customers()
        {
            var customers = _customerProvider.GetCustomers();

            return Json(customers,JsonRequestBehavior.AllowGet);
        }
    }
}
